#coding:gbk

from smartcard import *

def main():
    n = 0x010001
    for i in range(1, n):
        print hex(i), ": ",
        for j in range(1, n):
            if i * j % n == 1:
                print hex(j),
        print

def main2():
    n = '\x10'
    i = '\x01'

    while True:
        cmp_result = mplib_cmp(i, n)
        if cmp_result >= 0:
            break
        inv = mplib_inv_mod(i, n)
        mplib_dump(inv, "inv")
        i = mplib_add_d(i, 1)

main2()

